<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>用户列表</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="<%=path%>/resources/css/reset.css"
	type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="<%=path%>/resources/css/qr.css"
	type="text/css" media="screen" />
<link rel="stylesheet" href="<%=path%>/resources/css/invalid.css"
	type="text/css" media="screen" />
<link type="text/css"
	href="<%=path%>/resources/date/jquery.datepick.css" rel="stylesheet" />
</head>
<body>
	<form action="userPage.action" id="ilist" method="post">

		<div id="body-wrapper">
			<div style="text-align:right">
				<input class="button" type="button" value="查   询" style="width:80px"
					style="margin-top:0px;" id="btnlogin" onclick="javascript:query()"/>&nbsp;&nbsp;&nbsp; 
				<input	class="button" type="button" value="新   增" style="width:80px"
					style="margin-top:0px;" id="btnlogin" onclick="javascript:addUser()"/>&nbsp;&nbsp;&nbsp;
			</div>

			<!-- End #sidebar -->
			<div id="main-content">


				<!-- End .clear -->
				<div class="content-box">
					<div id="basic">
						&nbsp;用户类型:
						<s:select name="user.type" cssStyle="width:163px;height:30px"
							list="#request.userTypeMap" listKey="key" listValue="value"
							value="user.type" headerKey="-1" headerValue="请选择" id="user_type"></s:select>
						姓名:
						<s:textfield cssClass="text-input" id="user_name" name="user.name"
							cssStyle="width:80px" />
						用户名:
						<s:textfield cssClass="text-input" id="user_loginname"
							name="user.loginname" cssStyle="width:80px" />
					</div>
					<div class="content-box-content">
						<div class="tab-content default-tab" id="tab1">

							<table>
								<thead>
									<tr>
										<th><input class="check-all" type="checkbox" />
										</th>
										<th>姓名</th>
										<th>类型</th>
										<th>用户名</th>
										<th>操作</th>
									</tr>
								</thead>

								<tbody>

									<s:iterator value="#request.userList" id="rpt1" status="rpt">
										<tr>
											<td><input type="checkbox" name="rptid"
												value='<s:property value="uid"/>' />
											</td>
											<td><s:property value="name" />
											</td>
											<td><s:property value="@com.xyz.business.service.impl.UserHelper@getUserTypeName(type)" />
											</td>
											<td><s:property value="loginname" />
											</td>
											<td align="center"><a href="#" title="修改"> <img
													src="<%=path%>/resources/images/icons/pencil.png" alt="修改"
													onclick='javascript:edit(<s:property value="uid"/>)' /> </a> <a
												href="#" title="删除"> <img
													src="<%=path%>/resources/images/icons/cross.png" alt="删除"
													onclick='javascript:del(<s:property value="uid"/>)' /> </a> <!--  
											<a href="#" title="Edit Meta">
												<img src="<%=path%>/resources/images/icons/hammer_screwdriver.png"	alt="Edit Meta" /> 
											</a>--></td>
										</tr>

									</s:iterator>
								</tbody>
								<tfoot>
									<tr>
										<td colspan="6"><s:property value="pageContent"
												escape="false" /> <input type="hidden" id="pageNow"
											name="pageNow" value='<s:property value="pageNow"/>' /> <input
											type="hidden" id="rptId" name="rptId" />

											<div class="clear"></div>
										</td>
									</tr>
								</tfoot>
							</table>
						</div>

					</div>
					<!-- End .content-box-content -->
				</div>

				<!-- End #footer -->
			</div>
			<!-- End #main-content -->
		</div>
	</form>
</body>
<!-- Download From www.exet.tk-->
</html>
<script type="text/javascript"
	src="<%=path%>/resources/scripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/resources/date/jquery.datepick.js"></script>
<script type="text/javascript"
	src="<%=path%>/resources/date/jquery.datepick-zh-CN.js"></script>
<script type="text/javascript">

function page(num,type){
	var now = <s:property value="pageNow"/>;
	if(type==-1){
		$("#pageNow").val(now-1);
	}else if(type==1){
		$("#pageNow").val(now+1);
	}else{
		$("#pageNow").val(num);
	}

	$("#ilist").submit();
};

function query(){
	$("#ilist").submit();
};

function del(uid){
	var answer = confirm("是否删除该用户?");
	if(answer){
		$("#ilist").attr("action", "delteUser.action?user.uid="+uid);
		$("#ilist").submit();
	}
	else{
		return;
	}
	
	
};

function edit(uid){
	$("#ilist").attr("action", "addUser.action?user.uid="+uid);
	$("#ilist").submit();	
};

function addUser(){
	$("#ilist").attr("action", "addUser.action").submit();
}

//根据
$(document).ready(function() {
	//聚焦用户名
	$("#user_type").change(function() {
		$("#ilist").submit();
	});
});

</script>

